/*
 * @Description:
 * @Author:  huangshuai
 * @Date: 2023-10-17 16:56:33
 * @LastEditTime: 2023-11-08 14:25:52
 * @LastEditors: huangshuai
 */
import axios from "@/utils/request";

//点击举报信息
export function addReportInfo(data: any) {
  return axios.service({
    url: "/report/addReportInfo",
    method: "post",
    data,
  });
}
//社区业主查看自身被举报信息列表
export function listBadReportInfoCheckByUser(page: number, pageSize: number) {
  return axios.service({
    url: `/report/listBadReportInfoCheckByUser?page=${page}&pageSize=${pageSize}`,
    method: "get",
  });
}
//社区业主查看自己过往的举报信息
export function listReportInfoByUserId(page: number, pageSize: number) {
  return axios.service({
    url: `/report/listReportInfoByUserId?page=${page}&pageSize=${pageSize}`,
    method: "get",
  });
}
//确认自己被举报状态
export function updateReportHandleStatus(reportId: number) {
  return axios.service({
    url: `/report/updateReportHandleStatus/${reportId}/1`,
    method: "put",
  });
}
//被举报用户发起申请清除不良记录
export function updateBadInfoRecord(
  reportId: number | string,
  userExplain: string
) {
  return axios.service({
    url: `/report/updateBadInfoRecord/${reportId}/${userExplain}`,
    method: "post",
  });
}
//条件分页查询宠物信息列表
export function getListPetInfo(
  address: string,
  page: number = 1,
  pageSize: number,
  petName: string,
  isStray: string,
  health: string,
  searchAll: string = "0"
) {
  return axios.service({
    url: `/pet/listPetInfo?address=${address}&page=${page}&pageSize=${pageSize}&petName=${petName}&isStray=${isStray}&health=${health}&searchAll=${searchAll}`,
    method: "get",
  });
}
//添加宠物信息
export function addPetInfo(data: any) {
  return axios.service({
    url: "/pet/addPetInfo",
    method: "post",
    data,
  });
}

//修改宠物信息
export function updatePetInfo(data: any) {
  return axios.service({
    url: "/pet/updatePetInfo",
    method: "put",
    data,
  });
}
//删除宠物信息
export function deletePet(petId: number | string) {
  return axios.service({
    url: `/pet/deletePet/${petId}`,
    method: "get",
  });
}
//按条件查询帖子(不传标题查全部)
export function searchPost(
  categoryName: string,
  page: number = 1,
  pageSize: number = 10,
  titleName: string
) {
  return axios.service({
    url: `/post/searchPostByParams?categoryName=${categoryName}&page=${page}&pageSize=${pageSize}&titleName=${titleName}`,
    method: "get",
  });
}
//查看详情
export function checkPost(postId: string | number) {
  return axios.service({
    url: `/post/preview/${postId}`,
    method: "get",
  });
}
//发评论
export function addComment(
  postId: string | number,
  parentUserId: string | number,
  content: string
) {
  return axios.service({
    url: "/comment/addComment",
    method: "post",
    data: {
      content: content,
      grandCommentId: 0,
      isLeaf: 0,
      parentCommentId: 0,
      parentUserId: parentUserId,
      picturePath: "",
      postId: postId,
    },
  });
}
//帖子点赞
export function postLike(postId: string | number, likeStatus: string | number) {
  return axios.service({
    url: `/post/postLike/${postId}/${likeStatus}`,
    method: "put",
  });
}
//获取评论
export function lookAllComment(
  postId: string | number,
  page: number | string = 1,
  pageSize: number | string = 10
) {
  return axios.service({
    url: `/comment/lookAllComment/${postId}?page=${page}&pageSize=${pageSize}`,
    method: "get",
  });
}
//评论点赞
export function commentLike(
  postId: string | number,
  commentId: number | string,
  likeStatus: number | string
) {
  return axios.service({
    url: `/comment/commentLike/${postId}/${commentId}/${likeStatus}`,
    method: "put",
  });
}
//发表帖子
export function addPost(data: any) {
  return axios.service({
    url: "/post/addPost",
    method: "post",
    data,
  });
}


// 挂失宠物
export function addPetLossRecordInfo(data: any) {
  return axios.service({
    url: "/petLoss/addPetLossRecordInfo",
    method: "post",
    data,
  });
}
// 编辑宠物挂失状态
export function updatePetLossRecordInfo(data: any) {
  return axios.service({
    url: "/petLoss/updatePetLossRecordInfo",
    method: "post",
    data,
  });
}
//查询宠物挂失列表
export function listPetLossRecordInfo(
  petName: string,
  page: number = 1,
  pageSize: number,
  phone: string
) {
  return axios.service({
    url: `/petLoss/listPetLossRecordInfo?petName=${petName}&page=${page}&pageSize=${pageSize}&phone=${phone}`,
    method: "get",
  });
}

